function PasswordRecovery()
{
	this.init = function()
	{
		var controlBtn = $(".control .change");
		var pw1El = $("#pw1");
		var pw2El = $("#pw2");
		var pw1 = "";
		var pw2 = "";
		var pw = {
			pw1: "",
			pw2: ""
		};
		var addOnChangeEvent = function(el, prop)
		{
			$(el).on("change", function()
			{
				pw[prop] = $(this).val();
			});
			$(el).removeAttr("id");
		}

		addOnChangeEvent(pw1El, "pw1");
		addOnChangeEvent(pw2El, "pw2");

		$(controlBtn).on("click", function()
		{
			var filters = util.filters();
			util.appendFilter({val: pw.pw1, name: "Contraseñas",  filters: [filters.PASSWORD_MATCH], extraval: pw.pw2});
			util.appendFilter({val: pw.pw1, name: "Contraseña 1", filters: [filters.MAX_SIZE], extraval: 50});
			util.appendFilter({val: pw.pw1, name: "Contraseña 1", filters: [filters.MIN_SIZE], extraval: 7});
			util.appendFilter({val: pw.pw2, name: "Contraseña 2", filters: [filters.MAX_SIZE], extraval: 50});
			util.appendFilter({val: pw.pw2, name: "Contraseña 2", filters: [filters.MIN_SIZE], extraval: 7});
			var afterFilterFx = function()
			{
				var afterChangeFx = function(response)
				{
					response = JSON.parse(response);
					if(util.handleResponseError(response))
					{
						return;
					}
					util.goTo("/");
				};
				var params = {
					pw1: pw.pw1,
					pw2: pw.pw2
				};
				$.post("passwordRecovery", params, afterChangeFx);
			};
			util.runFilters(afterFilterFx);
		});
	};
	this.init();
};

var pr = new PasswordRecovery();